/**
 * Created by LeonTao on 29/06/2017.
 */
window.requestAnimFrame = function () {
    return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (n) {
            window.setTimeout(n, 1e3 / 60)
        }
}();
var noise = function () {
    var n, t, e, i, a, o, m, r = function () {
        n = document.getElementById("canv"), t = n.getContext("2d"), n.width = a = 700, n.height = o = 500, t.fillStyle = "hsla(255,255%,255%,1)", t.fillRect(0, 0, a, o), t.fill(), e = t.getImageData(0, 0, a, o), i = e.data, m()
    };
    m = function () {
        setInterval(function () {
            window.requestAnimFrame(m), u()
        }, 30)
    };
    var u = function () {
        for (var n = 0; n < i.length; n += 4) {
            var a = 255 * Math.random() + 50;
            i[n] = a, i[n + 1] = a, i[n + 2] = a
        }
        t.putImageData(e, 0, 0)
    };
    return {init: r}
}();
noise.init();